package com.joysuch.wwyt.api.dataaccess.bean;

import com.joysuch.wwyt.bp.entity.BpProductionFacility;
import com.joysuch.wwyt.core.common.util.SimpleDateFormatCache;
import lombok.Data;

import java.util.Date;

/**
 * @Author ZhangDong
 * @Date 2020/8/17 15:11
 */
@Data
public class SafeDeviceBean {

    private String Name;//设备名称
    private String AssetNumber;//固定资产编号 //todo
    private String ProductModel;//规格型号
    private String Number;//设备编码
    private String MakeCorp;//制造商 //todo
    private String NeedCheck;//是否需要检查 'false' //todo
    private String CheckCycle;//检查周期 //todo
    private String CheckAlert;//检查前几天提醒 //todo
    private String NeedUpkeep;//是否需要保养 'false' //todo
    private String UpkeepCycle;//保养周期 '30'
    private String UpkeepAlert;//保养前几天提醒 '15'
    private String SafeLevel;//安全等级 '二级' //todo
    private String UseDate;//投入使用日期 '2018-08-08'
    private String UserYear;//使用年限 '3 年'
    private String State;//状态 0 正常 1 停 用 2 报废

    public SafeDeviceBean(BpProductionFacility device) {
        this.Name = device.getName();
        this.ProductModel = device.getEquipmentModel();
        this.Number = device.getCode();
        this.UpkeepCycle = device.getMaintainPeriodDays() == null ? null : device.getMaintainPeriodDays() + "天";
        this.UpkeepAlert = device.getRemindAheadDays() == null ? null : device.getRemindAheadDays().toString();
        Date putIntoUseDate = device.getPutIntoUseDate();
        this.UseDate = putIntoUseDate == null ? null : SimpleDateFormatCache.getYmd().format(putIntoUseDate);
        this.UserYear = device.getServiceLifeMonths() == null ? null : device.getServiceLifeMonths() + "月";
        this.State = device.getState().toString();
    }
}
